 #include<iostream>
 using namespace std;
 void quicksort(int a[],int left,int right){
 	int i=left,j=right,p=right;
 	if(i>=j){
 		return;
	 }
	 while(i!=j){
	 	while(i!=j&&a[i]<a[p]){
	 		i++;
		 }
		while(i!=j&&a[j]>a[p]){
			j++;
		}
		swap(a[i],a[j]);
	 }
	 swap(a[p],a[i]);
	 quicksort(a,left,j-1);
	 quicksort(a,j+1,right);
	 
 }
 int main(){
 	int a[5]={5,2,3,1,4};
 	quicksort(a,0,4);
 	for(int i=0;i<5;i++){
 		cout<<a[i]<<" "; 
	 }
 }
	
	
	
	

